<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<html lang="en">
<head>
    <th:block th:include="include :: header('修改配置信息')" />
</head>
<body  class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-config-update" action="update" method="post">
    <div class="col-md-12">
        <input type="hidden">
        <input name="id" type="hidden" th:value="${shopConfig.id}" />
        <div class="form-group">
            <label class="col-sm-3 control-label">联盟商费用：</label>
            <div class="col-sm-9">
                <input type="text" name="vipPrice" class="form-control" placeholder="请输入联盟商费用" th:value="${shopConfig.vipPrice}">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">内部人员联盟商费用：</label>
            <div class="col-sm-9">
                <input type="text" name="insidePrice" class="form-control" placeholder="请输入内部人员联盟商费用" th:value="${shopConfig.insidePrice}">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">内部联盟商费成交返费(百分比)：</label>
            <div class="col-sm-9">
                <div class="radio-box">
                    <input type="radio" id="vipReturnRatio_1" name="vipReturnRatio" value="5" th:checked="${shopConfig.vipReturnRatio==5}">
                    <label for="vipReturnRatio_1">5</label>
                </div>
                <div class="radio-box">
                    <input type="radio" id="vipReturnRatio_2" name="vipReturnRatio" value="10" th:checked="${shopConfig.vipReturnRatio==10}">
                    <label for="vipReturnRatio_2">10</label>
                </div>
                <div class="radio-box">
                    <input type="radio" id="vipReturnRatio_3" name="vipReturnRatio" value="15" th:checked="${shopConfig.vipReturnRatio==15}">
                    <label for="vipReturnRatio_3">15</label>
                </div>
                <div class="radio-box">
                    <input type="radio" id="vipReturnRatio_4" name="vipReturnRatio" value="20" th:checked="${shopConfig.vipReturnRatio==20}">
                    <label for="vipReturnRatio_4">20</label>
                </div>
                <div class="radio-box">
                    <input type="radio" id="vipReturnRatio_5" name="vipReturnRatio" value="25" th:checked="${shopConfig.vipReturnRatio==25}">
                    <label for="vipReturnRatio_5">25</label>
                </div>
                <div class="radio-box">
                    <input type="radio" id="vipReturnRatio_6" name="vipReturnRatio" value="30" th:checked="${shopConfig.vipReturnRatio==30}">
                    <label for="vipReturnRatio_6">30</label>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">外部联盟商费成交返费(百分比)：</label>
            <div class="col-sm-9">
                <div class="radio-box">
                    <input type="radio" id="outVipReturnRatio_1" name="outVipReturnRatio" value="5" th:checked="${shopConfig.outVipReturnRatio==5}">
                    <label for="outVipReturnRatio_1">5</label>
                </div>
                <div class="radio-box">
                    <input type="radio" id="outVipReturnRatio_2" name="outVipReturnRatio" value="10" th:checked="${shopConfig.outVipReturnRatio==10}">
                    <label for="outVipReturnRatio_2">10</label>
                </div>
                <div class="radio-box">
                    <input type="radio" id="outVipReturnRatio_3" name="outVipReturnRatio" value="15" th:checked="${shopConfig.outVipReturnRatio==15}">
                    <label for="outVipReturnRatio_3">15</label>
                </div>
                <div class="radio-box">
                    <input type="radio" id="outVipReturnRatio_4" name="outVipReturnRatio" value="20" th:checked="${shopConfig.outVipReturnRatio==20}">
                    <label for="outVipReturnRatio_4">20</label>
                </div>
                <div class="radio-box">
                    <input type="radio" id="outVipReturnRatio_5" name="outVipReturnRatio" value="25" th:checked="${shopConfig.outVipReturnRatio==25}">
                    <label for="outVipReturnRatio_5">25</label>
                </div>
                <div class="radio-box">
                    <input type="radio" id="outVipReturnRatio_6" name="outVipReturnRatio" value="30" th:checked="${shopConfig.outVipReturnRatio==30}">
                    <label for="outVipReturnRatio_6">30</label>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">海报图片：</label>
            <div class="col-sm-8">
                <button type="button" class="layui-btn" id="upload_main">上传图片</button>
                <div class="layui-upload-list">
                    <input type="hidden" id="mainUrl" th:value="${shopConfig.shareImg}" name="shareImg">
                    <p id="show_main">
                        <img th:src="${shopConfig.shareImg}">
                    </p>
                </div>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-12 col-sm-offset-3">
                <button type="submit" class="btn btn-primary">提交</button>
            </div>
        </div>
    </div>
</form>
</div>
<th:block th:include="include :: footer" />
</body>
<script>
    var prefix = ctx + "system/shopconfig";
    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/update", $('#form-config-update').serialize());
        }
    }


    layui.use('upload', function () {
        var $ = layui.jquery
            , upload = layui.upload;

        //普通图片上传
        var uploadInst = upload.render({
            elem: '#upload_main'
            , url: '/common/upload?type=1' //改成您自己的上传接口
            , done: function (res) {
                //如果上传失败
                if (res.code > 0) {
                    return layer.msg('上传失败');
                }
                //上传成功
                $("#show_main").html("<img src='" + res.url + "'>");
                $("#mainUrl").val(res.url);
            }
            , error: function () {
                //演示失败状态，并实现重传
                var demoText = $('#demoText1');
                demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
                demoText.find('.demo-reload').on('click', function () {
                    uploadInst.upload();
                });
            }
        });
    })
</script>
</html>